<template>

	<view class="root">
		<view class="status_bar">
			<!-- 这里是状态栏 -->
		</view>
		<view class="header">
			<text>首页</text>
		</view>
		<view class="body">
			
			<view class="tab">
				<text class="box_mini"></text><text>生活、助学</text>
			</view>

			<view class="box_content">
				<!-- <navigator  url="../kunnan/kunnan"></navigator> -->
				<view id="con_1" @click.stop="nav_kunnan()" class="con_1">
					<view class="ic">
						<view class="ic_box">
							<image src="/static/img/fire.png" mode=""></image>
							<text @click.stop>认定</text>
						</view>
					</view>
					<view class="con_txt">
						<text>困难生申请(校内)</text>
					</view>
					<view class="con_txt2">
						<text>信息入库</text>
						<image src="/static/img/jt.png" mode=""></image>
					</view>
					<image src="/static/img/hua.png" mode=""></image>
				</view>

				<view class="body_right">
					<view class="con_2" @click="feedback">
						<view class="con_txt">
							<text>咨询、反馈</text>
						</view>
						<view class="con_txt2">
							<text>异议上报</text>
							<image src="/static/img/jt.png" mode=""></image>
						</view>
						<image src="/static/img/hua2.png" mode=""></image>
					</view>

					<!-- 个人信息按钮 -->
					<view class="con_3" @click="nav_chunjie">
						<view class="con_txt">
							<text>春节补助</text>
						</view>
						<view class="con_txt2">
							<text>申请</text>
							<image src="/static/img/jt.png" mode=""></image>
						</view>
						<image src="/static/img/hua3.png" mode=""></image>
					</view>

				</view>

				<view class="clear_n"></view>
			</view>
			
			<!-- 我的申请 -->
			<view class="body_mle" @click="nav_applyList">
				<view class="">
					<image src="/static/img/file.png" mode=""></image>
				</view>

				<view class="mle_txt" >
					<text>我的申请</text>
					<text>文件 | 材料</text>
				</view>

				<view class="img_box">
					<image src="/static/img/jt.png" mode=""></image>
				</view>

			</view>
		</view>

		<view class="body_bot">
			<view class="title_box">
				<text class="box_mini"></text><text>奖、助学金相关</text>
			</view>

			<view v-for="n in list" :key="n.id" class="list_box" @click="inZizhu(n.id)">
				<view class="list_con">
					<view class="">
						<image :src="n.imgurl" mode=""></image>
					</view>
					<view class="">
						<text>{{n.txt1}}</text>
						<text>{{n.txt2}}</text>
					</view>
					

					<view class="list_jt">
						<image src="/static/img/jt.png" mode=""></image>
					</view>
					<view class="clear_n">

					</view>
				</view>
			</view>
			<view style="text-align: center;">
				<text>数据来源：学生资助管理中心</text>
			</view>
			<view style="text-align: center;">
				<text ><a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备2021022163号</a></text>
			</view>
			
		</view>
		<popup-stuid ref="popup" v-model="stu_id" @save="saveStu_id()"></popup-stuid>
		
		<!-- 咨询悬浮按钮 -->
		<view class="zx_box">
			                           
		</view>
	</view>
</template>

<script>
	var isurl = '';
	var that; // 当前页面对象
	var vk; // vk依赖
	
	import { getStuVersion } from "@/api/app.js"
	export default {
		data() {
			return {
				stu_id:'',
				yb_userid:'',
				url: '',
				appVersion:'',
				code:null,
				user_name: '未绑定',
				yibanUserinfo:null,
				name:'',
				list: [{
						id: 1,
						txt1: "国家助学金",
						txt2: '困难生',
						imgurl: '../../static/img/document.png'
					},
					{
						id: 2,
						txt1: "国家奖学金(未开放)",
						txt2: '符合相关条件',
						imgurl: '../../static/img/docu1.png'
					},
					{
						id: 3,
						txt1: '国家励志奖学金',
						txt2: '符合相关条件的家庭经济困难生',
						imgurl: '../../static/img/docu2.png'
					},
					
				]
			}
		},
		onPageScroll(e) {
			that.scrollTop = e.scrollTop;
		},
		methods: {
			nav_kunnan() {
				console.log("nav")
				vk.navigateTo({
					url: '../catch/item'
				});
			},
			nav_applyList(){
				uni.navigateTo({
					url:'../applyList/applyList'
				})
			},

			nav_chunjie() {
				uni.showToast({
					icon:'error',
					title:'系统关闭'
				})
				return
				vk.navigateTo({
					url:'../zizhu/chunjie/chunjie'
				})
			},
			feedback() {
				uni.showToast({
					icon:'error',
					title:'系统关闭'
				})
				return
				uni.navigateTo({
					url: './/pages/feedback/feedback'
				})
			},
			saveStu_id:function(){
				if(this.stu_id != ''){
					try {
						this.user_name = this.stu_id
					    uni.setStorageSync('stu_id', this.stu_id);
					} catch (e) {
					    // error
					}
					uni.showToast({
						icon:'none',
						title:'保存成功'
					})
					this.$refs.popup.close()
				}else{
					uni.showToast({
						icon:'none',
						title:'请输入学号'
					})
				}
				
			},
			inZizhu(e){
				switch(e){
					case 1:
						// uni.showToast({
						// 	icon:'error',
						// 	title:'系统关闭'
						// })
						// return
						vk.navigateTo({
							url:'../zizhu/guozhu/guozhu'
						})
						break
					case 3:
						uni.showToast({
							icon:'error',
							title:'系统关闭'
						})
						return
						vk.navigateTo({
							url:'../zizhu/guoli/index/index'
						})
						break
					case 4:
						
						break
				}
			},
			
		},

		// 页面载入
		onLoad: function(options) {
			// vk框架初始化
			that = this;
			vk = that.vk;
			that.options = options;
			
			
		},
		onShow:function(op){
		
			let valid = vk.getStorageSync('stuToken');
			
			if(!valid){
				//弹出未登录提示，用户确认后跳转易班登录
				uni.showModal({
					title:'提示',
					content:'请先登录',
					confirmText:'去登录',
					confirmColor:'red',
					success: (res) => {
						if(res.confirm){
							// location.href = 'https://openapi.yiban.cn/oauth/authorize?client_id=614fe373b8d36e16&redirect_uri=https://pyplwf.cn&state=lwf'
							vk.redirectTo('/pages/login/login');
						}
					}
				})
			} else {
				// this.yibanUserinfo = valid.user
				
			}
			
			
		},
		onReady: function() {
			
		},
		onBackPress: function() {

		}
	}
</script>

<style>
	page {
		background: #f5f5f5;
	}

	* {
		margin: 0;
		padding: 0;
	}

	text {
		-webkit-appearance: none;
	}

	.root {
		width: 100%;
		margin: 0 auto;
		min-width: 320px;
		max-width: 640px;

		font-size: 14px;
		font-family: -appple-system, Helvetica, sans-serif;
		line-height: 1.5;
		color: #666;
	}

	.status_bar {
		background-color: #3669f8;
	}

	.header {
		width: 100%;
		height: 45px;
		line-height: 45px;
		text-align: center;
		background-color: #3669f8;
		/* position: fixed; */
	}


	.header text {

		color: #fff;
		font-size: 23px;
		font-weight: 700;
	}

	.body {
		width: 100%;
		margin-top: 12px;
		overflow: hidden;
		background-color: #fff;
	}
	.userInfo {
		padding: 10rpx 40rpx;
		
	}
	
	.userInfo text {
		font-size: 16px;
		font-weight: 700;
	}

	.tab {
		margin-top: 10px;
		margin-left: 32px;
		margin-bottom: 10px;


	}

	.box_mini {
		display: inline-block;
		width: 3px;
		height: 20px;
		margin-right: 9px;
		background-color: #3669f8;
		vertical-align: text-bottom;
	}

	.tab text:nth-child(2) {
		color: #000000;
		font-size: 20px;
		font-weight: 700;
	}

	.con_1 {
		float: left;
		width: 40%;
		height: 130px;
		background-color: #e1e9fe;
		margin-left: 20px;
		position: relative;
		border-radius: 5px;
	}

	.body_right {
		width: 40%;
		height: 130px;
		float: right;
		margin-right: 20px;
	}

	.con_2 {
		overflow: hidden;
		width: 100%;
		height: 60px;
		background-color: #feefed;
		margin-right: 20px;
		position: relative;
		border-radius: 5px;
	}

	.con_3 {

		overflow: hidden;
		width: 100%;
		height: 60px;
		background-color: #fef4df;
		margin-top: 8px;
		margin-right: 20px;
		position: relative;
		border-radius: 5px;
	}

	.con_1>image,
	.con_2>image,
	.con_3>image {
		position: absolute;
		width: 40px;
		height: 40px;
		right: 10px;
		bottom: 8px;
	}

	.ic {
		width: 50%;
		height: 25px;
		overflow: hidden;
		/* text-align: center; */
		background-color: #ff993d;
		border-bottom-right-radius: 5px;
		border-top-left-radius: 5px;
	}

	.ic_box {
		margin-top: 5px;
	}

	.ic image {
		vertical-align: middle;
		width: 12px;
		height: 12px;
	}

	.ic text {
		margin-left: 2px;
		/* vertical-align: text-bottom */
		;
		/* line-height: 25px; */
		color: #fff;
	}

	.con_txt {
		overflow: hidden;
		margin-top: 15px;
		letter-spacing: 1.5px;
	}

	.con_txt text {
		margin-left: 5px;
		color: #000000;
		font-size: 16px;
		font-weight: 700;
		word-spacing: 1px;
	}

	.con_txt2 text {
		font-size: 10px;
		margin-left: 5px;
	}

	.con_txt2 image {
		vertical-align: middle;
		width: 12px;
		height: 12px;
	}

	.clear_n {
		clear: both;
	}

	.body_mle {

		height: 70px;
		margin: 10px 20px;
		border-radius: 5px;
		box-shadow: 0px .3px .8px #c8c8c8;
	}

	.body_mle view:nth-child(1),
	.list_con view:nth-child(1) {
		float: left;
		overflow: hidden;
		height: 70px;
	}

	.body_mle view:nth-child(2),
	.list_con view:nth-child(2) {
		float: left;
		overflow: hidden;
		height: 70px;
	}


	.body_mle view:nth-child(1) image {

		width: 40px;
		height: 40px;
		margin-top: 15px;
		margin-left: 20px;

	}

	.mle_txt {
		margin-left: 25px;
	}

	.mle_txt text,
	.list_con text {
		display: block;

	}

	.mle_txt text:nth-child(1) {
		margin-top: 15px;
		color: #000000;
		font-weight: 700;
	}

	.img_box,
	.list_jt {
		float: right;
	}

	.img_box image {
		/* float: right; */

		width: 25px;
		height: 25px;
		margin: 22.5px 5px 0 0;
	}

	.title_box {
		margin: 10px 0 10px 32px;
	}

	.title_box text:nth-child(2) {
		color: #000000;
		font-size: 20px;
		font-weight: 700;
	}

	.list_box {
		height: 75px;
		background-color: #fff;
		margin: 8px;
		border-radius: 3px;
		overflow: hidden;
	}

	.list_con image {
		width: 40px;
		height: 40px;
	}

	.list_con text:nth-child(1) {
		color: #000000;
		/* font-size: px; */
		font-weight: 700;
	}

	.list_con text {
		margin-left: 20px;
	}

	.list_con {
		margin-top: 17.5px;
		margin-left: 20px;
	}

	.list_jt image {
		margin-top: 8px;
		margin-left: 20px;
		width: 25px;
		height: 25px;
	}
	
	.rdjg {
		
		padding: 10px 20px;
	
		
	}
	.rdjg image {
		/* margin-top: 10px; */
		/* line-height: 25px; */
		width: 25px;
		height: 25px;
	}
	
	.rdjg_text text{
		
	}
	
</style>
